import Vue from 'vue'
import App from './App.vue'
import router from './router';
import store from './store';
import iview from 'iview';
import 'iview/dist/styles/iview.css';
import api from '@/api';
import jquery from 'jquery';
import moment from 'moment';
// import jsplubmplugin from '@c/vue-jsplumb';

window.$ = jquery;
window.jquery = jquery;
window.jQuery = jquery;


Vue.use(api);
// Vue.use(jsplubmplugin);
Vue.use(iview, {
    transfer: true,
    size: 'small'
});
Vue.use(api);


// 日期过滤器
Vue.filter('dateFormat', function (value) {
    let timeobj = moment(value);
    if (timeobj.isValid()) {
        return timeobj.format('YYYY/MM/DD');
    } else {
        return '';
    }
});
// 时间过滤器
Vue.filter('timeFormat', function (value) {
    let timeobj = moment(value);
    if (timeobj.isValid()) {
        return timeobj.format('YYYY/MM/DD hh:mm');
    } else {
        return '';
    }
});

/**
 * 截取字符串
 */
Vue.filter('textIntercept', function (value, length) {
    if ((typeof value === 'string') && value.constructor === String) {
        return value.substr(0, length) + '...';
    } else {
        return value.toString().substr(0, length) + '...';
    }
});

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
